<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let CreateDiv = function( html ){
        this.html = html;
        this.init();
    };
    CreateDiv.prototype.init = function(){
        let div = document.createElement( 'div' );
        div.innerHTML = this.html;
        document.body.appendChild( div );
    };
// 接下来引入代理类 proxySingletonCreateDiv：
    var ProxySingletonCreateDiv = (function(){
        let instance;
        return function( html ){
            if ( !instance ){
                instance = new CreateDiv( html );
            }
            return instance;
        }
    })();
    let a = new ProxySingletonCreateDiv( 'sven1' );
    let b = new ProxySingletonCreateDiv( 'sven2' );
    console.log( a === b );
</script>
</body>
</html>
